package com.eugene.entity;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.eugene.element.FnCalendar;

public class VarmapId implements Serializable{
	private static final long serialVersionUID = 1L;

	private final static Logger logger = LoggerFactory.getLogger(VarmapId.class);	

	private FnCalendar baseDate;
	
	private String vcvMethodId;
	private String vcvType;
	
	private String scenarioId;
	
	public String getScenarioId() {
		return scenarioId;
	}
	public void setScenarioId(String scenarioId) {
		this.scenarioId = scenarioId;
	}
	private String positionId;
	
	private String hierarchyId1;
	private String hierarchyId2;
	private String hierarchyId3;

	
	public FnCalendar getBaseDate() {
		return baseDate;
	}
	public void setBaseDate(FnCalendar baseDate) {
		this.baseDate = baseDate;
	}
	
	public String getVcvMethodId() {
		return vcvMethodId;
	}
	public void setVcvMethodId(String vcvMethodId) {
		this.vcvMethodId = vcvMethodId;
	}
	public String getVcvType() {
		return vcvType;
	}
	public void setVcvType(String vcvType) {
		this.vcvType = vcvType;
	}
	public String getPositionId() {
		return positionId;
	}
	public void setPositionId(String positionId) {
		this.positionId = positionId;
	}
	
	public String getHierarchyId1() {
		return hierarchyId1;
	}
	public void setHierarchyId1(String hierarchyId1) {
		this.hierarchyId1 = hierarchyId1;
	}
	public String getHierarchyId2() {
		return hierarchyId2;
	}
	public void setHierarchyId2(String hierarchyId2) {
		this.hierarchyId2 = hierarchyId2;
	}
	public String getHierarchyId3() {
		return hierarchyId3;
	}
	public void setHierarchyId3(String hierarchyId3) {
		this.hierarchyId3 = hierarchyId3;
	}
	
	public VarmapId(){
		
	}
	public VarmapId(FnCalendar baseDate
//						, String vcvMethodId, String vcvType
							,String posId){
		this.baseDate = baseDate;
//		this.vcvMethodId = vcvMethodId;
//		this.vcvType	= vcvType;
		this.positionId = posId;
	}
	
	public VarmapId(FnCalendar baseDate
						,String scenarioId
//						, String vcvMethodId, String vcvType
							,String posId, String hiearId1){
		this.baseDate = baseDate;
//		this.vcvMethodId = vcvMethodId;
//		this.vcvType	= vcvType;
		this.scenarioId =scenarioId;
		this.positionId = posId;
		this.hierarchyId1 = hiearId1;
	}
//	public VarmapId(FnCalendar baseDate,String scenarioId
////						, String vcvMethodId, String vcvType
//							,String posId, String hiearId1, String hiearId2){
//		this.baseDate = baseDate;
////		this.vcvMethodId = vcvMethodId;
////		this.vcvType	= vcvType;
//		this.scenarioId =scenarioId;
//		this.positionId = posId;
//		this.hierarchyId1 = hiearId1;
//		this.hierarchyId2 = hiearId2;
//	}
//	public VarmapId(FnCalendar baseDate,String scenarioId
////						, String vcvMethodId, String vcvType
//							,String posId, String hiearId1, String hiearId2, String hiearId3){
//		this.baseDate = baseDate;
////		this.vcvMethodId = vcvMethodId;
////		this.vcvType	= vcvType;
//		this.scenarioId =scenarioId;
//		this.positionId = posId;
//		this.hierarchyId1 = hiearId1;
//		this.hierarchyId2 = hiearId2;
//		this.hierarchyId3 = hiearId3;
//	}
	
	@Override
	public boolean equals(Object other){
		Boolean rst = false;
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof VarmapId))
			return false;
		VarmapId castOther = (VarmapId) other;
		
		if( this.getHierarchyId3() == null && this.getHierarchyId2() == null && this.getHierarchyId1() ==null){
			rst =this.getPositionId().equals(castOther.getPositionId())
					&& castOther.getHierarchyId3() ==null
						&& castOther.getHierarchyId2() ==null
							&& castOther.getHierarchyId1() ==null;
		}
		else if(this.getHierarchyId3() == null && this.getHierarchyId2() == null){
			rst =this.getPositionId().equals(castOther.getPositionId()) 
					&& this.getHierarchyId1().equals(castOther.getHierarchyId1())
						&& castOther.getHierarchyId3() ==null
							&& castOther.getHierarchyId2() ==null;
		}
		else if(this.getHierarchyId3() == null ){
			rst =this.getPositionId().equals(castOther.getPositionId()) 
					&& this.getHierarchyId1().equals(castOther.getHierarchyId1())
						&& this.getHierarchyId2().equals(castOther.getHierarchyId2())
							&& castOther.getHierarchyId3() ==null;
		}
		else {
			rst =this.getPositionId().equals(castOther.getPositionId()) 
					&& this.getHierarchyId1().equals(castOther.getHierarchyId1())
						&& this.getHierarchyId2().equals(castOther.getHierarchyId2())
							&& this.getHierarchyId3().equals(castOther.getHierarchyId3());
		}
			
		return rst;
//		return ( this.getPositionId().equals(castOther.getPositionId())
//					&&( this.getHierarchyId1()== null || this.getHierarchyId1().equals(castOther.getHierarchyId1())));
				
	}
	@Override
	public int hashCode(){
		return super.hashCode();
	}
	


}
